package com.servlet.request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author wzm
 * @create 2023-11-04 16:28
 * project_name:web2310
 * @Description
 */
//实现Servlet接口自己写功能分发太复杂  我们可以使用Servlet的子类来实现
@WebServlet("/req2")
public class RequestServlet2 extends HttpServlet {
    //get请求执行的方法
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("get执行了");
    }

    //post请求执行的方法
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("post执行了");
    }
}
